import {Star} from "../../types.ts";


interface SelectItemProps {
    star: Star,
    setOpen: (open: boolean) => void
    onChangSelect: (star: Star) => void
}

function SelectItem({star, setOpen,onChangSelect}: SelectItemProps) {
    const handleChangSelect = (star: Star) => {
        setOpen(false)
        onChangSelect(star)
    }
    return (
        <div className={`select-item ${star.active ? 'active' : ''}`} onClick={() => handleChangSelect(star)}>
            <div><img src={star.icon} alt="icon"/></div>
            <div>{star.label}</div>
            <div className="date">{star.date}</div>
        </div>
    )
}

export default SelectItem;